<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
		<title>自由课程讨论章节列表页</title>
		<link rel="stylesheet" href="../../css/mui.min.css" />
		<link rel="stylesheet" href="../../css/timecontrol.min.css" />
		<link rel="stylesheet" href="../../css/base.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/weui.min.css">
		<link rel="stylesheet" type="text/css" href="../../css/study.css" />
		<style>
			.btn_submit1 {
				color: #333;
				width: 50%;
				background: url(../../icon/add_discuss.png) no-repeat 25% center;
				background-size: 20px;
				background-color: #FFFFFF;
				border: 1px solid #dedede;
				font-size: 16px;
				padding-left: 18px;
			}
			.btn_submit2 {
				color: #FFFFFF;
				width: 50%;
				background: url(../../icon/team_discuss1.png) no-repeat 25% center;
				background-size: 20px;
				background-color: #FF9900;
				border: 1px solid #FF9900;
				font-size: 16px;
				padding-left: 18px;
				cursor: pointer;
			}
			.horcenter1 {
				position: absolute;
				left: 25%;
				-webkit-transform: translate(-50%,0);
				-ms-transform: translate(-50%,0);
				-o-transform: translate(-50%,0);
				transform: translate(-50%,0);
			}
			.horcenter2 {
				position: absolute;
				left: 75%;
				-webkit-transform: translate(-50%,0);
				-ms-transform: translate(-50%,0);
				-o-transform: translate(-50%,0);
				transform: translate(-50%,0);
			}
			button {
				border-radius: 1px;
			}
			.footer-view {
				position: fixed;
				left: 0;
				bottom: 0;
				margin: 0;
				width: 100%;
				height: 50px;
				padding: 0;
			}
			.footer-view .mui-btn-block {
				width: 50%;
				height: 100%;
				margin: 0;
				/*padding: 11px;*/
				font-size: 16px;
			}
			button:nth-child(2):active {
				background-color: #F0F0F0;
				border: 1px solid #dedede;
				color: #333;
			}
			button:nth-child(3):active {
				background-color: #FF9900;
				border: 1px solid #FF9900;
			}
		</style>
	</head>
	<body id="main" >
		<div class="base_style_color " id='BarAppearance' style="height: 22px;width: 100%"></div>
		<div class="base_navigation_bar base_style_color base_navigation_item_bar ">
			<a class="base_left_item" href="#" onclick="backClick()"> <img class="base_back_icon" src="../../image/icon_jiantou.png" alt=""> </a>
			<span id="title"></span>
			<a class="base_right_item base_hide_item" href="#"> </a>
		</div>
		<div class="footer-view" >
			<button id="sumbit_bt_th" type="button" class="mui-btn-warning horcenter btn_submit " onclick="JoinComment()" style="display: none">
				发表讨论
			</button>
			<button id="sumbit_bt1" type="button" class="mui-btn-block horcenter1 btn_submit1 " onclick="JoinComment()" style="display: none">
				发表讨论
			</button>
			<button id="sumbit_bt2" type="button" class="mui-btn-block horcenter2 btn_submit2 " onclick="openTeam()" style="display: none">
				小组讨论
			</button>
		</div>
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script src="../../script/mui.min.js"></script>
	<script src="../../script/common.js"></script>
	<script src="../../script/jquery.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="../../script/requestTool.js"></script>
	<script type="text/javascript">
		var pid = "";
		// 计划id
		var cid = "";
		//课程id
		var chapterid = "";
		//章节id
		var title = "";
		apiready = function() {
			sendBuriedNotifi('0', '自由讨论列表页', '032');
			var pageParam = api.pageParam;
			$('#title').text(api.pageParam.cdetailtitle);
			if ($api.getStorage('cfnetSelectType') == 1) {//老师
				$('#sumbit_bt_th').show();
				$('#sumbit_bt1').hide();
				$('#sumbit_bt2').hide();
			} else {
				$('#sumbit_bt_th').hide();
				$('#sumbit_bt1').show();
				$('#sumbit_bt2').show();
			}
			addframe();
			backKey();
			//接收弹出通知
			//			ReceivePopNotifi();
		};
		function sendBuriedNotifi(busionessid, pagetype, pagetypeid) {
			var userinfo = {
				uid : $api.getStorage('cfnetppuid'),
				jid : $api.getStorage('cfnetppjxid'),
				uname : $api.getStorage('cfnetppusername'),
				cid : api.pageParam.cid,
				pid : api.pageParam.pid,
				vid : api.pageParam.chapterid
			}
			var data = {
				busionessid : busionessid,
				pagetype : pagetype,
				pagetypeid : pagetypeid,
				sourceurl : api.pageParam.sourceurl,
				sourcetitle : api.pageParam.sourcetitle,
				accesspageurl : window.location.pathname,
				accesspagetitle : document.title,
				userinfo : userinfo
			}
			SendBehaviorTrajectoriesNotifi_Study(data);
		}

		function ReceivePopNotifi() {
			api.addEventListener({
				name : 'PopNotifi'
			}, function(ret, err) {
				$('#offlineAlert').show();
				hideSubFrame();
			});
		}

		function backClick() {
			sendBuriedNotifi('1', '自由课程讨论章节列表页', '032');
			api.closeWin({
			});
		}

		function addframe() {
			var y = $('.base_navigation_bar').height() + 22;
			var h = api.winHeight - y - 54;
			api.openFrame({
				name : 'New_Student_FreeCourse_DiscussChapterFrame',
				url : 'New_Student_FreeCourse_DiscussChapterFrame.html',
				rect : {
					x : 0,
					y : y,
					w : 'auto',
					h : h
				},
				pageParam : {
					pid : api.pageParam.pid,
					cid : api.pageParam.cid,
					chapterid : api.pageParam.chapterid,
					cdetailtitle : api.pageParam.cdetailtitle,
					bewrite : api.pageParam.bewrite,
					is_dis_bewrite : api.pageParam.is_dis_bewrite,
					sourceurl : window.location.pathname,
					sourcetitle : document.title,
				},
				bounces : false,
				vScrollBarEnabled : true,
				hScrollBarEnabled : false,
				//				scrollEnabled : false,
			});
		}

		function JoinComment() {
			api.openFrame({
				name : 'New_FreeCourse_AddDiscus',
				url : 'New_FreeCourse_AddDiscus.html',
				pageParam : {
					pid : api.pageParam.pid,
					cid : api.pageParam.cid,
					chapterid : api.pageParam.chapterid,
					title : api.pageParam.cdetailtitle,
				},
			});
		}

		function openTeam() {
			api.openWin({useWKWebView:true,
				name : 'Student_PanelDiscussionWindow',
				url : 'Student_PanelDiscussionWindow.html',
				pageParam : {
					pid : api.pageParam.pid,
					cid : api.pageParam.cid,
					chapterid : api.pageParam.chapterid,
					title : api.pageParam.cdetailtitle,
					bewrite : api.pageParam.bewrite,
					type : 0
				},
			});
		}

		function backKey() {
			api.addEventListener({
				name : 'keyback'
			}, function(ret, err) {
				backClick();
			});
		}
	</script>
</html>
